﻿
namespace Sai.Core.Reporting
{
	using System;
	using System.IO;

	public class FileBasedStyleRepository : IReportStyleRepository
	{
		public FileBasedStyleRepository(string folder)
		{
			if (string.IsNullOrEmpty(folder))
				throw new ArgumentNullException();

			this.Folder = folder;
		}

		private string Folder { get; set; }

		public IReportStyler Find(string styleName)
		{
			if (string.IsNullOrEmpty(styleName))
			{
				return null;
			}

			if (Directory.Exists(this.Folder))
			{
				return new FileBasedReportStyler(this.Folder);
			}

			return null;
		}
	}
}
